Model Predictive Control (MPC) of a Countercurrent Flow Plate Heat Exchanger in a Virtual Environment

This research proposes advanced model-based control strategies for a countercurrent flow plate heat exchanger in a virtual environment. A virtual environment with visual and auditory effects is designed, which requires a mathematical model describing the real dynamics of the process; this allows parallel fluid movement in different directions with hot and cold temperatures at the outlet, incorporating control monitoring interfaces as communication links between the virtual heat exchanger and control applications. A multivariable and non-linear process like the plate and countercurrent flow heat exchanger requires analysis in the controller design; therefore, this work proposes and compares two control strategies to identify the best-performing one. The first controller is based on the inverse model of the plant, with linear algebra techniques and numerical methods; the second controller is a model predictive control (MPC), which presents optimal control actions that minimize the steady-state errors and aggressive variations in the actuators, respecting the temperature constraints and the operating limits, incorporating a predictive model of the plant. The controllers are tested for different setpoint changes and disturbances, determining that they are not overshot and that the MPC controller has the shortest settling time and lowest steady-state error.


Introduction
Industrialization and production have increased considerably in different areas of the world, which leads to the existence of multiple variables that must be controlled correctly.Industrialization requires efficiency, precision, and quality in manufactured products, which means that labor is a limiting resource for industrial development, so implementing an automatic control that meets needs, saves time, and solves issues of non-linearity or multivariable process controls is required [1].
In a world with extensive pollution, the search for solutions to this problem has become a priority.Among the considerable sources of pollution are greenhouse gasses (GHGs) caused by excess waste heat, which is why plate heat exchangers (PHEs) emerge as a tool to mitigate pollution.The European Union (EU) currently estimates that energy use will increase by 32.5% by 2030 [2].One relevant option is to optimize thermal energy recovery with the use of efficient and compact PHEs.
Because of the increase in energy demand and GHG emissions, efficient heat transfer management is necessary.A solution to these problems is to analyze the thermo-hydraulic performance of high-performance heat transfer systems [3,4].Industries have used traditional heat exchangers such as shell and tube heat exchangers that reduce heat to 50%.These exchangers have characteristics that are difficult to correct, such as a reduced hydraulic diameter and temperature differences.Contrary to conventional heat exchangers, plate heat exchangers are more energy efficient and compact, in addition to their high-quality manufacturing, which allows them to support high temperatures and pressures, with heat restoration rates around 90% [5,6].
At the beginning of 1923, plate heat exchangers (PHEs) were developed in the industrial area due to their mechanical structural shape, solid design, resistant characteristics, capacity to resist pressure drops, and efficient heat transfer management [7].Over time, these systems have become an essential part of the consumer, pharmaceutical, chemical, oil refining, and energy industries.In the same way, the modern energy sector has generated great interest in the study of various applications for efficient heating networks and low-temperature systems [8].According to [9], this type of unit has increased utility value because industries presently have a great demand in relation to heat transfer efficiency, and a considerable reduction in energy consumption is needed.
The heat exchanger is used in different applications requiring heat transfer, and for this reason, there are different types of designs.In the oil and gas industry, they can have configurations with sealed plates, circuit boards, shell and tube (sensors), plate and countercurrent flow (PHE), and shell and tube (STHE) systems [10].In chemical process applications, as well as refrigeration and heat recovery systems, shell and helical tube (HE)-type heat exchangers consisting of curved tubes inside a shell are frequently used.HE is used to reduce the temperature of lubricating oil [11].Meanwhile, the scraped surface heat exchanger (SSHE) is used for ice slurry production and food processing.Exchangers also have applications in buildings with energy-efficient technologies [12].
Currently, plate heat exchangers (PHEs) are very popular due to their compactness and high heat transfer coefficient.They constitute the beginning of a very efficient heat recovery system since their high performance, in combination with countercurrent flow, can obtain temperatures close to the final values, which is the temperature of the air in the ventilated space [13].They are most used in industrial applications, such as food, beverage, chemical, gas, and oil processes, among others, and are of interest for experimental, theoretical, and computational research.
Plate heat exchangers are extensively used in various industrial sectors, slightly less than the use of shell and tube heat exchangers [14].Another aspect of PHEs is their compact size, as they take up less space, making them attractive for food industries [15].PHEs are known for their high heat transfer efficiency in addition to their high thermal performance.There are variants of PHEs, such as corrugated plates, to strengthen the plates and produce turbulence in hot and cold fluids [16].Industry 4.0, in areas of the industrialization of distillation processes, has been modernized in terms of control, i.e., shifting from conventional controllers to advanced controllers [17].Due to their nature and complexity, PHEs present a great challenge in the area of control and supervision due to their distribution of transport parameters and variable time requirements, leading to steady-state studies because only contour measurements are available.For this reason, a simplified model containing the essential dynamics for the development is applied in this work.In [18], a number of applications in industry and engineering, such as energy production and chemical processes, among others, use two substances at different temperatures to exchange heat.The integrated energy system (IES) requires a link between an energy source and thermal loads.It is, therefore, essential to incorporate advanced controllers that reduce energy loss and ensure proper heat supply.
When the integral time is smaller, the error tends to decrease faster, but the system becomes underdamped if it is reduced too far, and the system becomes unstable [19].The proportional-integral (PI) controller is slower, and the response period is 50% longer than that of the proportional control.
For the control of plate heat exchangers, traditional proportional integral derivative (PID) controls have been reported in [20], which present a very high response rate but low control.In [21], a PI control is shown where the system tends to be damped and unstable, and its response time is slower.However, it has been evidenced that, in highly non-linear, Sensors 2024, 24, 4511 3 of 19 multivariable processes, traditional control algorithms such as PI and PID do not show the best performance in a transitory state; for example, in multivariable processes such as two-phase separators [22], three-phase separators and Desalination Plants [23], and combined cycle generation plants [24], advanced controllers have been demonstrated to be superior to traditional ones in aspects of overshoot, settling time, and rise time.
Therefore, studies of PHEs have been presented that analyze the model and the nonlinear parameters of this process, in order to develop optimal control algorithms.In the literature, there is limited information about the control of PHE.The control is applied to the output temperature according to [21] and uses an anticipatory control, focusing on the fuzzy model with a predictive control, in addition to classical PI and PID controllers with the Ziegler Nichols and Cohen Coon tuning methods.The other manuscript [25] describes a functional predictive control method based on a fuzzy model of the process and the prediction is performed with the Takagi-Sugeno (TS) technique.MPC controllers have been used in approximately 2500 industrial applications, such as the food, chemical, paper, refining, and petrochemical industries [26].In [27], a model-based control of compact heat exchangers is proposed that allows the performance of heat transfer and its robustness to disturbances in the refrigerant distribution system.This controller uses the total terminal energy as the main control variable instead of the output temperature, while in [19], two control methods are applied: the first one is a linear Gaussian control (LQG) and is compared with quantitative feedback (QFT).These controllers are based on the temperature control of the cold stream at the PHE output, and these controllers consider the analysis of the effect of uncertainty in the parameters, variable setpoint changes, and error rates.In [28], a control of district heating processes is shown, which seeks the efficiency and stability of the heating substation, where a loop configuration controller with two degrees of freedom is presented and is compared with a PI control that rejects existing perturbations.
On the other hand, process virtualization has become an essential tool in the industrial field, facilitating that equipment, machinery, equipment, and plants are moved to an animated environment as a cyber-physical object.In industry, it is feasible to perform tests, configurations, programming, and prediction of maintenance virtually before application [29].Virtualization consists of separating physical hardware from the execution of software, in order to have a greater operational versatility [30].In different areas of industries such as the aerospace, defense, and automotive industries, industrial process model designs have been used to reduce time in the development, design, and validation of equipment, as well as to reduce manufacturing costs [31].In the academic area, virtual environments similar to real production processes have been developed for control applications, for example, in [32], which shows a virtual generation plant based on solar collectors with real information from the Almeria plant in Spain, or virtual laboratories designed based on real laboratory stations, such as the virtualization of the FESTO reactor station [33].
This research proposes the development of controllers for a plate heat exchanger and countercurrent flow, which controls the variables of cold outlet temperature and hot outlet temperature; for this process, two types of advanced controls are applied to determine the most efficient and best performance in a transient and steady state in PHE.The first controller is based on linear algebra techniques, specifically based on the inverse model of the plant, and the second advanced controller is an MPC.The prediction model is based on differential equations, and the design of the controller provides robustness with respect to disturbances in the measurements of the control loop sensors.The mathematical model and the implemented controls are made through Matlab R2020a software; taking into account regulation tasks, an interactive environment with the user is considered, such as a virtual 3D environment of an industrial process, which is oriented to teaching and learning within the area of process control.This allows a quasi-real immersion through the simulation of the process with the use of the visual and sound effects of an industrial environment.The virtual development is made possible by the Unity 3D platform that together with the Visual Studio 2019 software allows the implementation of lines of code in which the models, effects, and communication links are added.The proposed controllers are finally validated for their performance in different scenarios that the plant may present in the event of a perturbation.
The main contribution of this research is the creation of an immersive virtual environment for a more intuitive interaction between the user and the industrial process, allowing the adaptation and identification of instruments, subprocesses, process variables, etc., and also having the possibility to manipulate different parameters and experiment with different configurations before being taken to the real plant.For a correct operation, two controllers are implemented and compared in order to visualize their efficiency in the process.The first controller focuses on the principles of linear algebra-denominated control based on the inverse of the plant, which requires knowledge of the behavior of the plant and the complications with non-linear systems or with uncertainties; therefore, an advanced control technique (MPC) ideal for non-linear systems is proposed to predict the behavior of the system in the future.The model considers the structure of the PHE and the ideal conditions of the system, with the objective of applying the corresponding modeling techniques and starting from the energy balance principle in order to obtain the differential equations that describe the system.

Description of the Counter Current Flow Plate Heat Exchanger
The heat exchanger is structured by a number of metal plates with parallel corrugations providing the direction of movement to the fluids that propagate in these channels.These plates are bolted together and covered with two covers.Each plate has four holes that allow the circulation of water in parallel but in different directions.The available water is at different temperatures-hot water and cold water.The hot water is driven by the even plates at the same time the cold water is driven by the odd plates so that there is heat exchange between the two fluids as shown in Figure 1 [28].
together with the Visual Studio 2019 software allows the implementation of lines of c in which the models, effects, and communication links are added.The proposed cont lers are finally validated for their performance in different scenarios that the plant m present in the event of a perturbation.
The main contribution of this research is the creation of an immersive virtual e ronment for a more intuitive interaction between the user and the industrial process lowing the adaptation and identification of instruments, subprocesses, process variab etc., and also having the possibility to manipulate different parameters and experim with different configurations before being taken to the real plant.For a correct operat two controllers are implemented and compared in order to visualize their efficiency in process.The first controller focuses on the principles of linear algebra-denominated c trol based on the inverse of the plant, which requires knowledge of the behavior of plant and the complications with non-linear systems or with uncertainties; therefore advanced control technique (MPC) ideal for non-linear systems is proposed to predict behavior of the system in the future.The model considers the structure of the PHE the ideal conditions of the system, with the objective of applying the corresponding m eling techniques and starting from the energy balance principle in order to obtain the ferential equations that describe the system.

Description of the Counter Current Flow Plate Heat Exchanger
The heat exchanger is structured by a number of metal plates with parallel corru tions providing the direction of movement to the fluids that propagate in these chann These plates are bolted together and covered with two covers.Each plate has four h that allow the circulation of water in parallel but in different directions.The available ter is at different temperatures-hot water and cold water.The hot water is driven by even plates at the same time the cold water is driven by the odd plates so that there is h exchange between the two fluids as shown in Figure 1 [28].The control loop 100 presents the reading of the hot output temperature (Th o ) through a temperature-indicating transmitter (TIT3 − 100) whose signal enters a comparator where it is subtracted from the desired hot output temperature (Th o * ).The difference generates an error (e 1 ) that enters the controller and generates the control action (µ h ) that is directed to the control valve (CV 1 ) of the hot fluid line 100, regulating the flow from a tank of hot water.In the same way, the control loop 101 contains the reading of the cold outlet temperature (Tc o ) through a temperature-indicating transmitter (TIT1 − 101) which generates a signal to the second comparator which is subtracted from the desired cold outlet temperature (Tc o * ).The difference generates an error (e 2 ) which is corrected by the control action (µ c ) that goes to the control valve (CV 2 ) of the cold fluid line 101, where the flow from a cooling tower is regulated.The cooling tower is supplied by a cold water tank when the liquid level in the cooling tower is low, so a pump is turned on until a considerable liquid level is reached in the cooling tower.
For control applications, the following variables are determined as variables to be controlled: hot output temperature (Th o ) and cold output temperature (Tc o ), and as manipulated variables: hot input temperature (Th i ) and cold input temperature (Tc i ).

Mathematical Modeling of the Countercurrent Flow Parallel Plate Heat Exchanger
In the development of the mathematical modeling of the counter-flow plate heat exchanger, different aspects of the structure and the thermodynamic process that takes place inside the heat exchanger are considered.These considerations previous to the mathematical modeling of the plate heat exchanger and countercurrent flow are as follows: (a) Under ideal and static operating conditions, i.e., the rates of change in flow (∆m) and temperature (∆T) are constant and independent of time only at the time of modeling; (b) Heat losses to or from the environment are negligible; (c) There are no sources of thermal energy in the exchanger walls; (d) The temperature of each fluid is uniform over each cross-section of the exchanger; (e) There is no phase change in the fluid stream; (f) Longitudinal heat conduction between the fluids and the walls is negligible; (g) The heat transfer coefficients (U) are constant; (h) The specific heat (C i )of each fluid is constant; (i) The heat transfer surface is uniformly distributed on each side of the fluid [18,34].
Let (T) be a function of temperature depending on time (t) and the mass flow of the fluid as seen in Equation ( 1): What is transferred in the plates at that instant is energy, so the accumulated energy (E a ) is the sum of the input energy flow (E i ) minus the output energy flow (E o ) plus the gained energy flow E g minus the lost energy flow (E l ), obtaining (2).
If the energy balance is performed at the plate side, then the temperature flux is constant.According to this characteristic, the energy flow lost (E l ) is equal to zero.In addition, this balance is performed on the cold junction plate.If we take into account the direction of flow of the accumulated energy and the time instant (∆t) over the longitudinal area of the plate, subjected to a delta of the energy gained, we obtain (3): where ( 3) is defined by the increase in the cumulative temperature around the plate , which is equal to the increase in the rate of energy flow at the inlet .
E i minus the increase in the rate of energy flow at the outlet .
E o and the increase in the rate of energy gained .E g .In this section, the energy equation is based on the dynamic and physical principles.Where the energy (E) is equal to the sum of the internal energies of the plate (θ itl ), kinetic (k), and potential (φ), we obtain Equation ( 4).
As defined at the beginning, the plate and countercurrent flow exchanger are not taken in a reference frame with respect to the speeds of both the fluid flow and the exchanger itself, and there is no reference frame with respect to the height of the kinetic energies (k) and potential (φ), i.e., these variables are equal to zero, resulting in Equation (5).
The internal energy (θ itl ) is composed of the product between the mass of the fluid or mass flow rate (m) and the specific heat with respect to the volume of the fluid (C v ) and the difference between the average temperature (T) and a reference temperature (T R ), obtaining (6).
The total differential of the internal energy (dθ itl ) is equal to the addition of the partial derivative of the same internal energy with respect to temperature (dT) at a constant volume and the partial derivative of the same internal energy with respect to volume (dV) at a constant temperature, as shown in Equation (7).
Also, the specific heat with respect to volume (C v ) is equal to the partial derivative of the internal energy with respect to temperature at a constant volume and its expression is given in (8).
It is considered that the partial derivative of the internal energy, with respect to temperature at a constant volume, dT approaches the partial derivative of the enthalpy (H) with respect to temperature at a constant pressure dT , obtaining the specific heat with respect to pressure C p .As indicated in the conditions, these parameters remain constant for incompressible liquids and solids, thus defining Equation (9).
Substituting ( 10) into (3), we obtain the generalized outlet temperature for any mass flow rate represented in (11).
We posit that the energy gain E g is also a type of internal energy for the plate in which the model is analyzed and is related to the heat in the longitudinal area of the plate (L) plus the work (W).Above, it is specified that there is no energy variation from and to the surroundings; then, the work is equal to zero as observed in (12). .
Equation ( 11) is rewritten according to the above considerations, thus obtaining (12), and the increments are related to the mass flows .m i and .m o , obtaining Equation (13).
The first law of thermodynamics indicates that the rate of heat transfer from the hot fluid (Q h ) is equal to the heat transfer to the cold fluid (Q c ) as seen in Equations ( 14) and (15), keeping the increments for the modeling process as follows: where .The hot stream produces a heat flow that must overcome the overall resistance (1/U • A) to transfer heat in order to obtain a temperature rise of the cold stream.Where (A) is the heat transfer area, (U) is the heat transfer coefficient, and ∆T is the temperature difference, the total heat transferred (Q t ) is expressed according to Equation (16).
We designate ∆T as the difference between the cold (Tc) and hot (Th) temperatures.(U) presents a perturbation because it depends on the temperatures, characteristics, and velocity of the flow.The total heat transfer area is represented by Equation ( 17) where (N p ) is the number of plates, and A p is the plate area.
The overall heat transfer coefficient (U) can be expressed according to Equation (18), where (λ h ) is the convective heat transfer coefficient of the hot fluid, (λ c ) is the convective heat transfer coefficient of the cold fluid, (j p ) is the plate thickness, (z p ) is the thermal conductivity of the plate, (q f ,c ) is the fouling factor of the cold fluid, and (q f ,h ) is the fouling factor of the hot fluid.
An important consideration is the convective heat transfer coefficient (λ) which is subject to fluid properties, velocity, and plate geometry.This coefficient allows the calculation of the most important parameter which is the total heat transfer inside the plate heat exchanger.For the design of the PHE, the log mean temperature difference method is used.For this method, the heat transfer rate is given by Equation ( 19): where (T med ) is the logarithmic mean temperature difference expressed in Equation (20).
(F) is the correction factor for the logarithmic mean temperature difference.
The following conditions must be considered for the case of countercurrent flow.
The correction factor is a function of the heat exchanger configuration and dimensionless parameters such as the heat capacity coefficient (R) and the temperature efficiency (Pc).For the case of countercurrent flow devices, the correction factor is equal to one.Also, the end channels of the PHE only exchange heat with one adjacent channel; therefore, the countercurrent or concurrent flow is equal to one in two extreme situations as presented in Equations ( 21) and (22).
Equation ( 23) represents the rate of energy stored inside the heat exchanger ( .Q r ) and is defined as the difference between the thermal energy provided by the flow ( .Q y ) and the total heat transfer ( Sensors 2024, 24, 4511 9 of 19
given by the product between the density of water ρ and the fluid velocity (v) and the temperature (T).Equations ( 14)-( 16) and ( 23) allow us to determine the energy balance for each current as expressed in Equations ( 24) and ( 25): where M h and M c are the masses of the hot and cold fluids, C ph and C pc are the specific heats of the hot and cold fluids, Th i and Tc i are the inlet temperatures of the hot and cold fluids, and Th o and Tc o are the outlet temperatures of the hot and cold fluids, respectively.The average temperature (Th) and (Tc) on the hot side and cold side are expressed in Equations ( 26) and (27).
The energy balance in the steady state around the cold plate and hot plate is realized by implementing the equations of the mean temperatures of the hot and cold sides in Equations ( 28) and (29).These equations represent the non-linear mathematical model of the counter-flow plate heat exchanger.

Virtual Environment Developed
Figure 3 represents the virtualization process and connection between Unity Hub 3.7.0software and Matlab R2020a software, where they work together in the process of a countercurrent flow plate heat exchanger.The Unity Hub 3.7.0software allows for realistic virtualized environments in 2D and 3D planes, in addition to being suitable and compatible for control applications, in order to guide the community to increase their educational level in the industrial field since it shows a metaverse environment, which allows an immersive experience in education.
Figure 3 is made up of four sections, the light blue section corresponds to the scene, i.e., the virtual environment of the plate heat exchanger and countercurrent flow together with the control panels and visualization of the process variables.All these elements have been designed and modeled using a CAD platform, in this case AutoCAD Plant 3D and SketchUP.These designs are converted to .fbxformat for later import into Unity Hub 3.7.0software.The green section Scripts is composed of Game Objects which contain and organize components that define the behavior of the objects in a scene, besides allowing the exchange of data with the Matlab R2020a software, in addition to the digitization of the code that allows the exchange of information between Matlab and Unity 3D.The orange section contains the Matlab R2020a software where the mathematical model of the process is implemented, in addition to the control architectures.The communication is performed through shared memories through a DLL program which serves as a connection point between the Matlab R2020a software and Unity 3D.The red-colored section called output includes process operation effects such as sounds and alarms and the behavior in the event of a disturbance.

Design of System Control Strategies
Figure 4 shows the general closed-loop scheme of the plate heat exchanger, in which two control architectures are applied in order to compare and observe the desired dynamic behavior of the outlet temperature (Tc o ) and (Th o ), which changes due to the effect of the input of two temperatures, one cold and the other hot: (Tc i ) and (T hi ).The process is perturbed to evaluate the efficiency of each controller.Figure 4 details the general control scheme, where the control signals leaving the controller are represented by the terms µ c (k) and µ h (k), and this signal enters the process, i.e., the input temperatures T i (k).Also, the term representing the desired temperatures are Tc o * (k) and Th o * (k) for regulation tasks, while the control errors are given by Equation (30).The output temperatures taking into account the perturbation is given in Equation ( 31): where dm c (k), dm h (k) is a vector of disturbances in the control loop sensor measurements.T are the outputs of the process, W is the matrix associated with the dynamic parameters of the process, the vectors T i are the inputs to the process, and the matrix C is a matrix associated with the non-evolving states of the process., where it represents the non-linear model of the process in matrix form.

Control Based on the Inverse of the Plant
Therefore, the vectors T  are the outputs of the process, W is the matrix associated with the dynamic parameters of the process, the vectors i T are the inputs to the process, and the matrix C is a matrix associated with the non-evolving states of the process.The equations of the ( 32) and ( 33) model are represented in the continuous time domain.
Matrix representation of the model, which will be implemented in the closed-loop control scheme.

Methodology for Controller Design
The process is of the following form: .
Considering regulation tasks, we have the error expressed as Sensors 2024, 24, x FOR PEER REVIEW 14 of 21 Considering regulation tasks, we have the error expressed as Substituting (36) in (35) and considering a weight matrix W to saturate the errors,

Predictive Control (MPC)
The model-based predictive control algorithm makes use of an internal dynamic prediction model of the process, a history of past information, an optimization cost function J, a prediction horizon, a control horizon, weights, and constraints associated with the process [36].The mathematical model of the countercurrent plate heat exchanger is intended to predict the future behavior of its outputs: for this case, the cold outlet temperature ˆo Tc and as the hot outlet temperature ˆo Th as a function of ( ) , present and past.This predicted output vector is subtracted from the vector of ( ) SP to obtain the errors Substituting (36) in (35) and considering a weight matrix W to saturate the errors, According to Figure 5, the control actions are equal to the temperatures entering the process µ = T, and we have the control law in (37).

Predictive Control (MPC)
The model-based predictive control algorithm makes use of an internal dynamic prediction model of the process, a history of past information, an optimization cost function J, a prediction horizon, a control horizon, weights, and constraints associated with the process [36].The mathematical model of the countercurrent plate heat exchanger is intended .The resulting control actions are subject to the weights (see Figure 6).

Predictive Control (MPC)
The model-based predictive control algorithm makes use of an internal dynamic prediction model of the process, a history of past information, an optimization cost function J, a prediction horizon, a control horizon, weights, and constraints associated with the process [36].The mathematical model of the countercurrent plate heat exchanger is intended to predict the future behavior of its outputs: for this case, the cold outlet temperature ˆo Tc and as the hot outlet temperature ˆo Th as a function of ( ) , present and past.This predicted output vector is subtracted from the vector of ( ) SP to obtain the errors its assigned error γ 2 (k) is considered.In the controller formulation, one of the purposes is to protect the actuator.That is why an additional control objective is included.To minimize the changes in the control actions, therefore, we have [∆u 1 (k + i − 1)] 2 , i.e., the square of the variation in the control actions for the input cold temperature variable with its respective weight ρ 1 (k).For the control variable hot entry temperature, we have its respective variation in the control action [∆u 2 (k + i − 1)] 2 and its respective weight ρ 2 (k), where k indicates a sample, N p is the prediction horizon, and N c is the control horizon.
In general terms, Tc o (k + i k) is the predicted cold outlet temperature, while Th o (k + i k) is the predicted hot outlet temperature.As Tc o * (k + i|k) is the desired cold temperature, similarly, Th o * (k + i|k) is the desired hot temperature.As for the variations in the control actions, the expression The countercurrent flow plate heat exchanger has operating constraints that are included in the optimization problem and are considered limits of the cold outlet temperature Tc o defined in Equation (39), where Tc omin is the minimum cold outlet temperature, and Tc omax is the maximum cold outlet temperature.The temperature described in Equation (40) represents the operating range of Th o , where Th omin is the minimum hot outlet temperature, and Th omax is the maximum hot outlet temperature.As for the control value, its values were restricted between a maximum limit (∆µ max ) and a minimum limit (∆µ min ), as seen in Equation (41), and the second control action is represented in Equation (42).

Results
This section shows the results of the interface designed in an immersive virtual environment: subsequently, the control strategies based on the inverse of the plant and MPC are compared in order to determine the best-performing control.

Virtual Countercurrent Flow Plate Heat Exchanger Environment
The application developed was tested on a computer with the following characteristics: 16 GB of RAM, 2.4 GHz processing speed, and a Ryzen 9 processor, generating a dynamic interaction with the user in a realistic environment.The interface is shown in Figure 7a with all the elements that make up the industrial environment where the heat exchanger has been used-elements such as tanks, motors, valves, pipes, the heat exchanger itself, etc. Figure 7b presents the control area where three panels are implemented: the first is the control panel where the control variables (CV) are displayed, which are process temperature inputs, desired temperature values (SP), and disturbances such as mass flow rate (dm); the second monitor displays the hot outlet temperature (Th o ); while the third monitor is used to display the variable cold outlet temperature (Tc o ).This tool has become an aid in learning industrial process control with advanced control techniques.
Sensors 2024, 24, x FOR PEER REVIEW 16 of 21 Figure 7a with all the elements that make up the industrial environment where the heat exchanger has been used-elements such as tanks, motors, valves, pipes, the heat exchanger itself, etc. Figure 7b

Performance of the Proposed Controllers for the Countercurrent Plate Heat Exchanger
The two designed control strategies are compared.For the control based on the inverse of the plant, the diagonal weight matrix W with values of 0.2 on its diagonal is defined.For the MPC control, the parameters used for the plate heat exchanger and countercurrent flow are Figure 8a shows the behavior of the hot outlet temperature under different control

Performance of the Proposed Controllers for the Countercurrent Plate Heat Exchanger
The two designed control strategies are compared.For the control based on the inverse of the plant, the diagonal weight matrix W with values of 0.2 on its diagonal is defined.For the MPC control, the parameters used for the plate heat exchanger and countercurrent flow are ∆u 1min = 0 and ∆u 1max = 100, and for the second control action, ∆u 2min = 0 and ∆u 2max = 100, which corresponds to the valve openings.The limits for the hot outlet temperature are Th omin = 0 and Th omax = 75, and for the cold outlet temperature, Tc omin = 0 and Tc omax = 45.These values represent the operating range of the exchanger.Regarding the tuning parameters of this controller, they are obtained heuristically by obtaining the weights of the hot outlet temperatures: γ 1 = 1 and γ 2 = 1, respectively.As for the weights for the control actions, ρ 1 = 0.001 and ρ 2 = 0.001 are defined.Then, we need additional parameters such as the prediction horizon N f = 10 in addition to the control horizon N c = 1 with a sampling time of 0.1 s.
Figure 8a shows the behavior of the hot outlet temperature under different control strategies.Control based on the inverse of the plant is represented in green, while MPC control is shown in blue.These strategies use a setpoint that varies every 60 s, the (SP) starts with a value of 30 • C, then changes to 40 • C, and finally changes to 50 • C. When analyzing the interval from 60 s to 120 s, neither controller presents overdrive.The MPC controller presents a lower settling time of 85 s compared to the controller based on the inverse of the plant which is 110 s.The MPC controller does not present steady-state error while the inverse model is minimal.With respect to the control actions in Figure 8b, the manipulated variable corresponding to the hot entry temperature is observed.For the case of the control based on the inverse of the plant, its control action begins to act from the instant of 0 s and reaches its steady state at the instant of 35 s, with a value of hot entry temperature of 36.19 • C. On the other hand, in the MPC control, its control action begins with a time of 5 s for its action and comes to stabilize at 36 s with a temperature value of 35.99  Table 1 presents the results of the control performance parameters of the implemented algorithms for the hot outlet temperature control.The overshoot, steadystate error, and settling time of the two controllers, based on the plant inverse and MPC, are compared.These parameters were analyzed in the plate heat exchanger and countercurrent flow.According to the values obtained, it is shown that the MPC control presents a lower settling time and lower steady-state error.Table 1 presents the results of the control performance parameters of the implemented algorithms for the hot outlet temperature control.The overshoot, steady-state error, and settling time of the two controllers, based on the plant inverse and MPC, are compared.These parameters were analyzed in the plate heat exchanger and countercurrent flow.According to the values obtained, it is shown that the MPC control presents a lower settling time and lower steady-state error.Figure 9a shows the behavior of the output cold temperature against different control strategies: plant inverse-based control (green), and an MPC control The set point (red) varies every 60 s.The set point (SP) starts with a value of 35 • C, then changes to 25 • C, and finally changes to 15 • C. When analyzing the interval from 60 s to 120 s, neither controller presents overshoot.The MPC controller presents a lower settling time of 78 s compared to the controller based on the inverse of the plant which is 100 s.The MPC controller does not present steady-state error, while for the inverse model it is minimal.On the other hand, the control actions in Figure 9b show the manipulated variable corresponding to the input cold temperature.For the case of the control based on the inverse of the plant, its control action begins to act from the instant of 0 s reaches its stationary state at the instant of 40 s, with an inlet cold temperature value of 29.15 • C. On the other hand, the MPC control initiates its action at 12 s and stabilizes at 38 s with a temperature value of 28.63 • C. It can be observed that, in equilibrium, the cold inlet temperature is set to approximately 28.5 • C in both controls to achieve the desired hot outlet temperature.Table 2 shows the control parameters such as the overshoot, time to enter steady state, and steady-state error of the two control algorithms based on the plant inverse and MPC for the control of the cold outlet temperature.It can be seen that the MPC control has a better performance compared to the control based on the inverse of the plant because the control actions are not abrupt.Consequently, the life of the actuator is taken care of and comes to stabilize faster than the other controller.The system is evaluated against external disturbances in order to test its robustness.Two perturbations are added by means of mass flows.Figure 10 shows the behavior of the system against perturbations.As shown in Figure 4, the external disturbances can be produced by changing the hot and cold mass flow () h dm and () c dm , respectively.These add to the variables to be controlled and cause changes in the outlet temperatures to be controlled.At 100 s, a disturbance is caused by changing the hot mass flow () h dm , which causes a change in the temperatures to be controlled.The cold mass flow () c dm has a Table 2 shows the control parameters such as the overshoot, time to enter steady state, and steady-state error of the two control algorithms based on the plant inverse and MPC for the control of the cold outlet temperature.It can be seen that the MPC control has a better performance compared to the control based on the inverse of the plant because the control actions are not abrupt.Consequently, the life of the actuator is taken care of and comes to stabilize faster than the other controller.The system is evaluated against external disturbances in order to test its robustness.Two perturbations are added by means of mass flows.Figure 10 shows the behavior of the system against perturbations.As shown in Figure 4, the external disturbances can be produced by changing hot and cold mass flow (dm h ) (dm c ), respectively.These add to the variables to be controlled and cause changes in the outlet temperatures to be controlled.At 100 s, a disturbance is caused by changing the hot mass flow (dm h ), which causes a change in the temperatures to be controlled.The cold mass flow (dm c ) has a constant value of 0.24 kg/s, while the hot mass flow (dm h ) has a value of 10 kg/s in the range 100 s to 120 s.This perturbation has an effect on the whole system as the mass flow is related to the outlet temperatures (see Figure 10c).The system is perturbed with hot mass flow of 10 kg/s at a time of 100 s (see Figure 10a).The hot outlet temperature when controlled with an MPC algorithm has a 10 s less settling time to compensate for the disturbance than control based on the plant inverse.Similarly, as shown in Figure 10b, the cold outlet temperature responds 21 s faster with the MPC control than with the control based on the plant inverse.As can be seen, the MPC controller performs better against perturbations.controlled with an MPC algorithm has a 10 s less settling time to compensate for the disturbance than control based on the plant inverse.Similarly, as shown in Figure 10b, the cold outlet temperature responds 21 s faster with the MPC control than with the control based on the plant inverse.As can be seen, the MPC controller performs better against perturbations.The results of this research are compared with results shown in related works, such as the one reported in [18] where a comparison of controls for plate heat exchangers and countercurrent flow is shown.Conventional PI and PID controls are evaluated with an advanced control based on fuzzy logic which shows a better performance.These three control strategies were analyzed and compared with the results obtained in this research, and it can be determined that the MPC control reduces the stability time by 115 s.In addition, the control signals are cleaner and smoother.

Conclusions
Learning and professional training in industry are strengthened by the use of real industrial plant models in immersive virtual environments, due to their dynamics and the variables to be controlled resembling the mode of operation of a real industrial process.The virtualized countercurrent flow and plate heat exchanger has proven to be an immersive industrial process that enables the scope of different applications of linear, nonlinear, and advanced control strategies.The communication link between the virtual environment and industrial process control variables is developed on a DLL platform, specifically designed for this type of teaching in a professional and educational method.
Two control algorithms for a virtualized countercurrent flow plate heat exchanger are implemented and compared: one based on the plant inverse and one MPC.Both controls present an acceptable performance with respect to the controlled variables of the hot outlet temperature and cold outlet temperature of the heat exchanger.However, the MPC control presents a better performance in a transient and a steady state.Both The results of this research are compared with results shown in related works, such as the one reported in [18] where a comparison of controls for plate heat exchangers and countercurrent flow is shown.Conventional PI and PID controls are evaluated with an advanced control based on fuzzy logic which shows a better performance.These three control strategies were analyzed and compared with the results obtained in this research, and it can be determined that the MPC control reduces the stability time by 115 s.In addition, the control signals are cleaner and smoother.

Conclusions
Learning and professional training in industry are strengthened by the use of real industrial plant models in immersive virtual environments, due to their dynamics and the variables to be controlled resembling the mode of operation of a real industrial process.The virtualized countercurrent flow and plate heat exchanger has proven to be an immersive industrial process that enables the scope of different applications of linear, non-linear, and advanced control strategies.The communication link between the virtual environment and industrial process control variables is developed on a DLL platform, specifically designed for this type of teaching in a professional and educational method.

Figure 1 .
Figure 1.Countercurrent flow plate heat exchanger developed from authors.

Figure 1 .
Figure 1.Countercurrent flow plate heat exchanger developed from authors.The P&ID diagram in Figure2describes the operation of the process, connected to the parallel plate heat exchanger and countercurrent flow.The process presents a control loop 100 corresponding to the hot water line (red arrow), while the cold water (blue arrow) belongs to the control loop 101.The temperatures are controlled by the variables' (µ h ) and (µ c ) signals that go to the control valves (CV 1 ) and (CV 2 ) for each line of the process.

Figure 2 . 1 e 1 CV 2 CV
Figure 2. P&ID diagram of the industrial process of a parallel plate heat exchanger with countercurrent flow.The control loop 100 presents the reading of the hot output temperature ( ) o Th

Figure 2 .
Figure 2. P&ID diagram of the industrial process of a parallel plate heat exchanger with countercurrent flow.
m h and .m c are the hot and cold mass flow increments, C ph and C pc are the specific heats of the hot and cold fluids, (Th i ) and (Tc i ) are the inlet temperatures of the hot and cold fluids, and (Th o ) and (Tc o ) are the outlet temperatures of the hot and cold fluids, respectively.

Figure 3 .
Figure 3. Virtualized system methodology of a counter-flow plate heat exchanger.

Figure 4
Figure 4 shows the general closed-loop scheme of the plate heat exchanger, in which two control architectures are applied in order to compare and observe the desired dynamic behavior of the outlet temperature ( ) o Tc and ( ) o Th , which changes due to the effect of the input of two temperatures, one cold and the other hot: ( ) i Tc and ( ) hi T .The process is perturbed to evaluate the efficiency of each controller.Figure 4 details the general control scheme, where the control signals leaving the controller are represented by the terms

Figure 4
details the general control scheme, where the control signals leaving the controller are represented by the terms signal enters the process, i.e., the input temperatures ( ) i T k .Also, the term representing the desired temperafor regulation tasks, while the control errors are given by Equation(30).The output temperatures taking into account the perturbation is given in Equation (31): a vector of disturbances in the control loop sensor measurements.

Figure 3 .
Figure 3. Virtualized system methodology of a counter-flow plate heat exchanger.

Figure 4 .Figure 5
Figure 4. Closed-loop control scheme of the countercurrent flow plate heat exchanger.3.1.Control Based on the Inverse of the Plant Figure 5 details the general diagram of the control based on the inverse of the plant.This controller, commonly known as non-linear internal model control, has evolved in applications in the industrial sector and its possible deconfiguration of the model[35].The development of the controller is obtained by inverting the model, considering the devel-

Figure 4 .
Figure 4. Closed-loop control scheme of the countercurrent flow plate heat exchanger.

Figure 5
Figure 5 details the general diagram of the control based on the inverse of the plant.This controller, commonly known as non-linear internal model control, has evolved in applications in the industrial sector and its possible deconfiguration of the model [35].The development of the controller is obtained by inverting the model, considering the development of differential equations describing the plant behavior and expressing it in matrix form . T = WT i + C, where it represents the non-linear model of the process in matrix form.Therefore, the vectors .

Figure 4 .
Figure 4. Closed-loop control scheme of the countercurrent flow plate heat exchanger.

Figure 5
Figure 5 details the general diagram of the control based on the inverse of the plant.This controller, commonly known as non-linear internal model control, has evolved in applications in the industrial sector and its possible deconfiguration of the model [35].The development of the controller is obtained by inverting the model, considering the development of differential equations describing the plant behavior and expressing it in matrix form W C i T T = + , where it represents the non-linear model of the process in matrix form.

Figure 5 .
Figure 5. Inverse-based control scheme of the plate heat exchanger plant and countercurrent flow.Figure 5. Inverse-based control scheme of the plate heat exchanger plant and countercurrent flow.

Figure 5 .
Figure 5. Inverse-based control scheme of the plate heat exchanger plant and countercurrent flow.Figure 5. Inverse-based control scheme of the plate heat exchanger plant and countercurrent flow.
According to Figure5, the control actions are equal to the temperatures entering the process T μ = , and we have the control law in (37).
future behavior of its outputs: for this case, the cold outlet temperature Tc o and as the hot outlet temperature Th o as a function of Tc o (k), Th o (k), µ c (k), µ h (k), present and past.This predicted output vector is subtracted from the vector of (SP) to obtain the errors ê1 = Th o * − Th o (k) and ê2 = Tc o * − Tc o (k) control actions are subject to the weights (see Figure6).

Figure 6 .Figure 6 .
Figure 6.Closed-loop MPC control scheme of the countercurrent flow plate heat exchanger.The MPC control includes an optimization problem where an objective function ( ) J k is posed which is presented in Equation (38) responsible for minimizing errors and abrupt control action changes.The first term

Figure 7 .
Figure7awith all the elements that make up the industrial environment where the heat exchanger has been used-elements such as tanks, motors, valves, pipes, the heat exchanger itself, etc. Figure7bpresents the control area where three panels are implemented: the first is the control panel where the control variables ( ) CV are displayed, which are process temperature inputs, desired temperature values ( ) SP , and disturb- ances such as mass flow rate ( ) dm ; the second monitor displays the hot outlet tempera- ture ( ) o Th ; while the third monitor is used to display the variable cold outlet temperature

1 cN
corresponds to the valve openings.The limits for the hot outlet temperature are min 0 values represent the operating range of the exchanger.Regarding the tuning parameters of this controller, they are obtained heuristically by obtaining the weights of the hot outlet temperatures: 1 1 γ = and 2 1 γ = , respec- tively.As for the weights for the control actions, 1 = with a sampling time of 0.1 s.

Figure 7 .
Figure 7. Virtual process environment: (a) industrial environment with heat exchanger and (b) monitoring and control area.

Figure 8 .
Figure 8. Controller performance based on plant inverse and MPC controller: (a) response of hot outlet temperature and (b) hot entry temperature.

FigureFigure 8 .
Figure9ashows the behavior of the output cold temperature against different control strategies: plant inverse-based control (green), and an MPC control (blue).The set point (red) varies every 60 s.The set point () SP starts with a value of

Figure 9 .
Figure 9. Controller performance based on plant inverse and MPC controller: (a) output cold temperature response and (b) input cold temperature.

Figure 9 .
Figure 9. Controller performance based on plant inverse and MPC controller: (a) output cold temperature response and (b) input cold temperature.

Figure 10 .
Figure 10.(a) Hot outlet temperature.(b) Cold outlet temperature.(c) Disturbances corresponding to the hot and cold mass flows h dm .

Figure 10 .
Figure 10.(a) Hot outlet temperature.(b) Cold outlet temperature.(c) Disturbances corresponding to the hot and cold mass flows dm h .
• C in equilibrium, showing that the hot inlet temperature is set in both controls at a value of approximately 36.00 • C to obtain the desired hot outlet temperature.

Table 1 .
Performance of control algorithms for hot temperature output.

Table 1 .
Performance of control algorithms for hot temperature output.

Table 2 .
Performance of control algorithms for cold temperature output.

Table 2 .
Performance of control algorithms for cold temperature output.